package home

import (
	"net/http"
	"site/app/middlewares"

	"github.com/gin-gonic/gin"
)

type IndexController struct{}

func NewIndexController() *IndexController {
	return &IndexController{}
}

func (ic *IndexController) Register(rg *gin.RouterGroup) {
	rg.GET("/", middlewares.Auth(), ic.Index)
	rg.GET("/about", ic.About)
}

func (ic *IndexController) Index(c *gin.Context) {
	c.JSON(http.StatusOK, gin.H{"data": "HelloWorld!"})
}

func (ic *IndexController) About(c *gin.Context) {
	c.HTML(http.StatusOK, "home/about.html", gin.H{
		"title": "About",
	})
}
